<?php

namespace app\index\controller\consulting;

use ShidianUtil\Thinkphp\Response\ApiResponse;
use ShidianUtil\Utils\CheckUtil;
use app\index\model\UM as UM;
use app\index\service\ConsultingPhoneService;
use think\APP;
use think\Request as Request;

/**
 * ConsultingPhone 控制器
 * Class ConsultingPhone
 * @package app\index\controller\consulting;
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 * @see \app\index\validate\consulting\ConsultingPhone
 */
class ConsultingPhone
{
    // 请求参数
    private Request $request;

    // service
    private ConsultingPhoneService $service;

    public function __construct(Request $request, ConsultingPhoneService $consultingPhoneService)
    {
        $this->request = $request;
        $this->service = $consultingPhoneService;
    }

    /**
     * 咨询赚钱-一键拨通
     * @param UM $user
     * @return ApiResponse
     * @url /consulting/consulting_phone/save
     */
    public function save(UM $user): ApiResponse
    {
        $request     = $this->request;

        $data = $this->service->bindAxbPhone($user, $request->param('messageId'), $request->param());

        return ApiResponse::success($data);
    }

}
